#include<stdio.h>
#define Maxsize 50 
typedef char ElementType;
typedef struct SNode *PtrToSNode;
struct SNode {
    ElementType Data[100];   
    int Top;
};
typedef PtrToSNode Stack;
int Push(Stack &S, char e);
void InitStack(Stack &S);
bool Pop(Stack &S,char &e);
int Match(Stack &S,char exp[],int n);
int main(){
	Stack S;
	char a[1000],e;
	int i=0,j=0,m,flag=0;
	while(	a[i]=getchar()){
		if(a[i-1]=='\n'&&a[i]=='.') break;
		i++;
	}
	InitStack(S);
	m=Match(S,a,i);
	switch (m){
		case 1: printf("NO\n?-)\n");flag=1;goto c;break;
		case 2: printf("NO\n?-}\n");flag=1;goto c;break;
		case 3: printf("NO\n?-]\n");flag=1;goto c;break;
		case 4: printf("NO\n?-*/\n");flag=1;goto c;break;
		case 5: break;
	}
	if(Pop(S,e)){
		switch (e){
			case '(': printf("NO\n(-?\n");flag=1;break;
			case '{': printf("NO\n{-?\n");flag=1;break;
			case '[': printf("NO\n[-?\n");flag=1;break;
			default : printf("NO\n/*-?\n");flag=1;break;
		}
	}
	else if(S->Top==-1&&flag==0){
		printf("YES");
		return 0;
	}
	c:return 0;
}
int Push(Stack &S, char e){
	if(S->Top==Maxsize-1) return false;
	S->Top++;
	S->Data[S->Top]=e;
	return true;
}
void InitStack(Stack &S){
	S=new SNode;
	S->Top=-1;
}
bool Pop(Stack &S, char &e){
	if(S->Top==-1) return false;
	e=S->Data[S->Top--];
	return true;
}
int Match(Stack &S,char exp[],int n){
	int i=0;
	char e,e1,e2;
	for(i=0;i<n;i++){
		if(exp[i]=='('||exp[i]=='{'||exp[i]=='[') Push(S,exp[i]);
		if((exp[i]=='/'&&exp[i+1]=='*')){
			Push(S,exp[i]);
			Push(S,exp[i+1]);
		}
		else if(exp[i]==')'){
			Pop(S,e);
			if(e=='(') continue;
			else return 1;
		}
		else if(exp[i]=='}'){
			Pop(S,e);
			if(e=='{') continue;
			else return 2;
		}
		else if(exp[i]==']'){
			Pop(S,e);
			if(e=='[') continue;
			else return 3;
		}
		else if(exp[i]=='*'&&exp[i+1]=='/'){
			if(exp[i-1]=='/'&&exp[i]=='*'&&exp[i+1]=='/') return 5;
			Pop(S,e1);
			Pop(S,e2);
			if(e1=='*'&&e2=='/') continue;
			else return 4;
		}
	}
	
	return 5;
}
